package com.kaibes.platform.member.api;

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.kaibes.platform.member.db.MemberVip;
import com.kaibes.platform.member.db.MemberVipService;
import com.kaibes.platform.member.pojo.MemberVipUpdate;
import com.kaibes.web.api.ApiLink;
import com.kaibes.web.api.ResponseApi;

@RestController
@RequestMapping("/members/vips")
public class MemberVipApi extends ResponseApi<MemberVip, MemberVipService>{

    @PostMapping
    @ApiLink("创建VIP会员类型")
    public ResponseEntity<List<Number>> post(@RequestBody MemberVip memberVip) {
        return super.post(memberVip, "创建VIP会员类型成功", "创建VIP会员类型失败");
    }
    
    @DeleteMapping
    @ApiLink("删除VIP会员类型，根据id")
    public ResponseEntity<Object> deleteByIdQuery(@RequestBody List<Integer> ids) {
        return super.deleteById(ids, "删除VIP会员类型成功", "删除VIP会员类型失败");
    }
    
    @DeleteMapping("/{id:\\d+}")
    @ApiLink("删除VIP会员类型，根据id")
    public ResponseEntity<Object> deleteByIdQuery(@PathVariable Integer id) {
        return super.deleteById(id, "删除VIP会员类型成功", "删除VIP会员类型失败");
    }
    
    @PutMapping("/{id:\\d+}")
    @ApiLink("修改VIP会员类型，根据id")
    public ResponseEntity<Object> putById(@PathVariable Integer id, @RequestBody MemberVipUpdate memberVip) {
        return super.putById(memberVip, id, "修改VIP会员类型成功", "修改VIP会员类型失败");
    }
}
